package com.intretech.tj.live.strategy

import com.intretech.tj.live.LiveVerticle
import com.intretech.tj.live.entity.DTO.PathRequest
import com.intretech.tj.live.entity.DTO.VehicleStatus
import com.intretech.tj.live.service.Live0Service
import jakarta.enterprise.context.ApplicationScoped
import org.slf4j.LoggerFactory

@ApplicationScoped
class Live0Strategy(
    private val live0Service: Live0Service
) : LiveStrategy {

    private val logger = LoggerFactory.getLogger(Live0Strategy::class.java)

    override fun handle(vehicleStatus: VehicleStatus): PathRequest? {
        logger.info("${vehicleStatus.vehicleId}, currentId 改变 ${vehicleStatus.currentNodeId} live0规划启动")
        val live0 = live0Service.live0ROS(vehicleStatus.vehicleId, vehicleStatus.currentNodeId)
        logger.info("live0规划结束 ${vehicleStatus.vehicleId} nextNode $live0")
        if (live0 != -1) {
            return PathRequest(vehicleStatus.vehicleId, null, live0, null)
        }
        return null
    }

    override fun mark(): Int = 0
}